<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.jiutian.hotel.business.impl.HotelListManagerImpl"%>
<%@ page import="java.text.SimpleDateFormat"%>
<%@ page import="com.jiutian.hotel.db.impl.HotelListDAOImpl"%>
<%@ page import="com.jiutian.hotel.pojo.*"%>
<%
String hotelid = request.getParameter("hotelid");
String roomid = request.getParameter("roomid");
String checkInDate = request.getParameter("checkin");
String checkOutDate = request.getParameter("checkout");
HotelInfoData hotelinfo=new HotelListDAOImpl().getHotelInfoByHotelid(hotelid);
HotelListManagerImpl impl=new HotelListManagerImpl();
List roomoffer=impl.getRoomOffer(roomid,"");
List roominfo=impl.getRoomInfoById(roomid);
Object[] room={"无","无","无","无",new Double(0.0),new Double(0.0),new Integer(0)};
Object[] offer={new Integer(0),"无","无"};
if(!com.jiutian.util.CheckUtil.isEmptyList(roominfo)) {//当有值时，否则就按上面默认值
	room=(Object[])roominfo.get(0);
}
if(!com.jiutian.util.CheckUtil.isEmptyList(roomoffer)) {
	offer=(Object[])roomoffer.get(0);
}
String startdate=(String)offer[1];
String enddate=(String)offer[2];
int roomOfLeft=((Integer)offer[0]).intValue();
StringBuffer options=new StringBuffer();
if(roomOfLeft==0) {
    options.append("<option value=\"-1\">无</option>");
} else {
options.append("<option value=\"1\">1</option><option value=\"2\">2</option><option value=\"3\">3</option><option value=\"4\">4</option><option value=\"5\">5</option>");
}
//ArrayList<String> todayAndTommorow=com.jiutian.util.Constants.getDate("yyyy-MM-dd",1);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  
  	<meta http-equiv="keywords" content="酒店,酒店预订"/>
    <meta http-equiv="description" content="九天是主要面向大学生提供酒店预订服务，价格低廉，品质优越"/>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
  
    <title>北京酒店</title>
	
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<link href="../../css/my.css" rel="stylesheet"/>
<link href="../../css/hotel_order.css" rel="stylesheet"/>
<link href="../../css/jquery-ui-1.8.13.custom.css" rel="stylesheet"/>
<script type="text/javascript" src="../../js/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="../../js/jquery-ui-1.8.13.custom.min.js"></script>
<script type="text/javascript" src="../../js/jquery-ui-i18n.min.js"></script>
<script>
	$(function() {
		$.datepicker.setDefaults($.datepicker.regional['zh-CN']);
		$.datepicker.setDefaults({dateFormat:'yy-mm-dd'});
		$( "#checkindate" ).datepicker({ minDate: +0 });
		$( "#checkoutdate" ).datepicker({ minDate: +0 });
	});
	function checkorder(){
		$("#m_contentend").css("display","none");
		var bValid=true;
		if($("#numOfRoom").val()=="-1"){//说明已经没有房间
			bValid=false;
			updateTips($("#warning"),"该类型房间已满，请选择其他房间！");
		} else {
			var startdate=$("#checkindate").val();
			var enddate=$("#checkoutdate").val();
			if(startdate>=enddate){
				bValid=false;
				updateTips($("#warning"),"入住日期不能早于或等于退房日期！");
			} else {
			if(startdate<'<%=startdate %>' || enddate>'<%=enddate %>'){
				bValid=false;
				updateTips($("#warning"),"入住日期与退房日期超出有效期：<%=startdate %>至<%=enddate %>！");
			} else {
				$("input[name='customerName']").each(function(){bValid=bValid&&checkLength($(this),'客户姓名',2,20,$("#warning"));});
				bValid=bValid&&checkLength($("#mobileNo"),'手机号码',11,11,$("#warning"));
				bValid=bValid&&checkLength($("#email"),'电子邮箱',0,50,$("#warning"));
				bValid=bValid&&checkRegexp($("#mobileNo"),/^([0-9a-zA-Z])+$/,'手机号码格式不正确！',$("#warning"));
				if($("#email").val()!='')
					bValid=bValid&&checkRegexp($("#email"),/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i,'电子邮箱格式不正确！',$("#warning"));
				}
			}
		}
		if(!bValid) {
			$("#m_contentend").css("display","");
			return false;
		}
		return true;
	}
	function changeCustomerName(){
		var no=parseInt($("#numOfRoom").val());
		var per=parseInt($("#per").val());
		$("#TotalAmount").text(per*no);
		$("#namebox").html("");
		for(var i=0;i<no;++i){
			$("#namebox").append("<div class=\"l_1\">客人姓名：</div><div class=\"r\"><span><input name=\"customerName\" value=\"\" class=\"text l_black\" type=\"text\"/></span></div>");
		}
	}
	$(document).ready(function() {
		changeCustomerName();
	})
</script>
  </head>
  <body>
	<jsp:include page="../bar.jsp" />
    <div id="fill_order">
    	
        <div class="top_side">
            <span class="l"></span><span class="r"></span>
        </div>
        <h1>填写订单</h1>
        <div class="side_box">
            <div class="t_s">
                <span class="l"></span><span class="r"></span>
            </div>
            <div class="main clx">
                <!--左侧内容-->
                
<div id="left">
        <div class="hotel_info">
          <div class="l"><img alt="" src="../../hotelphoto/small/<%=hotelinfo.getSmallpic() %>.jpg"/></div>
          <div class="r">
          <%=hotelinfo.getHotelname() %>
            <br/>
            
          </div>
          <div class="clear"></div>
          <!--促销信息-->
          <div class="rm_type">
            <ul>
              <li><span>房&nbsp;&nbsp;&nbsp;型：</span><%=room[0] %></li>
              <li><span>床&nbsp;&nbsp;&nbsp;型：</span><%=room[1] %></li>
              <li><span>早&nbsp;&nbsp;&nbsp;餐：</span><%=room[2] %></li>
              <li><span>宽&nbsp;&nbsp;&nbsp;带：</span><%=room[3] %></li>
              <li><span>面&nbsp;&nbsp;&nbsp;积：</span><%=room[6] %>平米</li>
            </ul>
          </div>
          <!--促销信息 end-->
        </div>
            
                    <!--why us-->
        <div class="bg why_us">
          <p class="t14 bold">为什么选择九天？ </p>
          <ul>
            <li class="mon">不收预订费 <span class="icon_info" title="部分客房因支付方式不同，可能需要您预付房款。"></span>&nbsp;&nbsp;<br/>省钱·更优惠的房价 </li>
            <li class="nasdaq">服务满意度超过99.7%</li>
          </ul>
        </div>
        <!--why us end-->

            <div class="mt20 pl20 ml5" style="display:;">
          <a href="http://www.ijiutian.com/help.html" title="点击查看详情" id="hrfquest">预订过程中常见问题&nbsp;<span class="icon_info"></span></a>
        </div>
        <!--联系艺龙-->
</div>

                <div id="right">
                    <!--客房,优惠信息-->
                    
<h2>
    客房信息</h2>
     <form name="orderform" action="../../hotel/addorder.do" method="post" onsubmit="return checkorder();">
     <input type="hidden" name="roomid" value="<%=roomid %>"/>
     <input type="hidden" name="hotelid" value="<%=room[7] %>"/>
     <input type="hidden" name="roomtype" value="<%=room[0] %>"/>
  <div class="pt10 mb15">
    <ul class="normal_list">
        <li><span class="wl">房型名称：</span><%=room[0] %></li>
        <li><span class="wl">房间数量：</span>
            <select id="numOfRoom" name="numOfRoom" class="fi_s1" id="rdoRoomNum" onchange="changeCustomerName()">
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
            <option value="4">4</option>
            <option value="5">5</option>
            </select>间
        </li>
        <li>
        	<span class="wl">入住日期：</span>
			<input id="checkindate" class="sc-w l_black" type="text" value="<%=checkInDate %>" name="checkindate"/>
			<label class="m-10" for="CheckOutDate">退房日期：</label>
			<input id="checkoutdate" class="sc-w l_black" type="text" value="<%=checkOutDate %>" name="checkoutdate"/>
        </li>
        <li><span class="wl">应付金额：</span><span class="bold orange CNY t14" id="TotalAmount"><%=room[5] %></span>&nbsp;元<span class="l_black pl20">(预订免费，入住后酒店前台付款)</span></li>
    	<input type="hidden" id="per" name="per" value="<%=room[5] %>"/>
    </ul>
    <div class="price_list">
    </div>
    <div class="cu">
        <!--返券-->
        <p class="pt5"><span class="wl">可享受优惠：</span>无</p>
        <div id="dvCouponInfo">
        </div>
    </div>
  </div>
                    <!--入住信息-->
<h2>入住信息</h2>
<!-- 
<div id="dvTemplate" style="display:none">
    <div>
        <div class="name_box clx">
            <div class="l_1">客人姓名：</div>
            <div class="r"><span><input name="customerName" value="姓名" class="text l_black" type="text"/></span></div>
        </div>
    </div>
    <div>
        <div class="name_box clx">
            <div class="l">客人姓名：</div>
            <div class="r"><span>房间{0}<br/><input value="姓名" class="text l_black" type="text"/></span></div>
        </div>
    </div>
</div>
-->
<div class="check_info" id="divCheckIn">
    <div>
        <div id="namebox" class="name_box clx">
        	<%for(int j=0;j<roomOfLeft;++j){ %>
            <div class="l_1">客人姓名：</div>
            <div class="r"><span><input name="customerName" value="" class="text l_black" type="text"/></span></div>
            <%} %>
        </div>
    </div>
	    <div id="m_contentend" style="display:none">
		<div class="com_bug" style="position: absolute; z-index: 5000; top: 471.5px; left: 780px;">
		<div id="warning" class="w"></div>
		</div>
		</div>
    <ul id="ulContact">
        <li class="readme"><span class="l_black">(每个房间只填1人姓名即可)<span class="icon_info"></span></span></li>
        <li class="mt10"><span class="w1">联系手机：</span><span class="w3"><input id="mobileNo" name="mobileNo" value="" id="CMobile" maxlength="11" class="text nor_text" type="text"/><span class="input_follow">(用于接收订单信息)</span></span></li>
        <li class="mt10"><span class="w1">E-mail：</span><span class="w3"><input id="email" name="email" value="" id="CEmail" maxlength="50" class="text nor_text" type="text"/><span class="input_follow">(可不填)</span></span></li>
    </ul>
    <ul id="ulVouch">
    <li class="mt15"><span class="w1">到酒店时间：</span><span style="display:;"><input name="arrivetime" class="radio" value="18:00以前" type="radio"/>18:00以前</span><span class="pl10"><input name="arrivetime" class="radio" value="18:00-次日06:00" type="radio"/>18:00-次日06:00</span> <span class="icon_info"></span></li>
    <li class="readme"><div class="com_tips"><div class="cnt_box"><span id="span1">房间保留至18:00，如不能在18:00前到酒店，请及时通知九天或与酒店联系。</span>  <span id="span2" style="display:none;">房间保留至7月27日12:00，7月25日 14:00 前免费取消订单，担保金额会立即退回。</span>  <span id="span3" style="display:none;"></span></div></div></li>
    <li style="display:;" class="readme l_black">(通常酒店14点办理入住，早到可能需要等待)</li></ul>
    <div id="checktime" class="danbao_tips mt10"><img id="srcimg" src=""/></div>
</div>

<div class="fapiao">注：如需发票，请从酒店前台索取</div>
                    <!--支付方式-->
                    <!--发票信息-->
	<div class="submit_box"><input id="ContinueOrder" tabindex="20" value="提交订单" onfocus="this.blur()" onmouseout="this.className='sub_order'" onmouseup="this.className='sub_order'" onmousedown="this.className='sub_order_on'" class="sub_order" type="submit" onsubmit="return checkorder();"/></div>
	</form>
	<div class="pt20 pl20">如果您在预订过程中遇到问题，请拨打15801300677 18911585580</div>
	</div>
	<div class="clear"></div>
	</div>
	<div class="clear"></div>
	<div class="d_s"><span class="l"></span><span class="r"></span></div>
	</div>
        <div class="down_side">
            <span class="l"></span><span class="r"></span>
        </div>
    </div>
    <jsp:include page="/hotel/footer.jsp" />
  </body>
</html>
